﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="List.aspx.cs" Inherits="Bookmark.Net.Views.Item.List" %>
<%@ Import Namespace="Bookmark.Net.Controllers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="BreadCrumbsPlaceHolder" runat="server">
<%=Html.RenderUserControl("~/Views/Item/BreadCrumbs.ascx", ViewData) %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainMenuPlaceHolder" runat="server">
<%=Html.RenderUserControl("~/Views/Item/MainMenu.ascx", ViewData) %>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="SearchBarPlaceHolder" runat="server">
     <div id="searchArea">
     <div id="searchAreaLeft">
     <%if (ViewData.userName != null)
       { %>
     <%=ViewData.userName.ToLower() == "all" ? "all" : ViewData.userName + "'s"%> items <%=ViewData.tagName != null && ViewData.tagName != string.Empty ? "tagged " + ViewData.tagName : ""%>
     <%} %>
     </div>
     <div id="searchAreaRight">
     <%using (Html.Form<ItemController>(c => c.Search(0))) 
        {%>

          <%= Html.TextBox("SearchText", Request.Form["SearchText"]) %> <select id="SearchIn"><option value="my">
             My Bookmarks</option><option value="bookmark.net">Bookmark.Net</option></select> <%=Html.SubmitButton("Search", "Search") %>
        <%} %>
     </div>
            <div class="clear"></div>

     </div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
<% if (ViewData.ErrorMessage != null){ %>
  <font color="red"><%=ViewData.ErrorMessage%></font>
<% } %>

<% if (ViewData.Items != null)
   { %>
  <ul >
    <% //foreach (var user in ViewData)
    foreach (var i in ViewData.Items)
    { %>

      <li> 
        <a href="<%=(i.ShortCut.IndexOf("://")>-1?i.ShortCut:"http://" + i.ShortCut)%>"><%=(i.Title==null?i.ShortCut:i.Title)%></a> <span class="itemActions"> <%= Html.ActionLink<ItemController>(c => c.Edit(i.ItemId), "edit")%></span>
      </li>
 <% } %>
  
  </ul>
  <% if (ViewData.Items.IsPreviousPage)
     { %>
      <%= Html.ActionLink<ItemController>(c => c.List(ViewData.Items.PageIndex - 1, ViewData.userName, ViewData.tagName), "Previous")%>
    <%} %>
<% if (ViewData.Items.IsNextPage)
   { %>
      <%= Html.ActionLink<ItemController>(c => c.List(ViewData.Items.PageIndex + 1, ViewData.userName, ViewData.tagName), "Next")%>
    <%} %>
<br />

<% } %>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="RelatedTagsPlaceHolder" runat="server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="TagsPlaceHolder" runat="server">
<h5>tags</h5>
<% if (ViewData.Tags != null)
   { %>
  <ul >
    <% foreach (var t in ViewData.Tags)
       { %>
      <li> <%=Html.ActionLink<ItemController>(c => c.List(0, ViewData.userName, t.TagName), t.TagName)%>
      </li>
    <% } %>
  
  </ul>
<%} %>
</asp:Content>
